/** 
 * 企业版在线接口
 * 命名空间:Dituhui.User
 */
Dituhui.Fence = Dituhui.Fence || {};

/** 
 * 绘制圆
 * @param: center - SuperMap.LonLat 圆的中心点
 * @param: radius - Number 圆半径，单位为km
 */
Dituhui.Fence.getCircleGeometry = function(center, radius) {
	radius *= 1000;
    var d360 = Math.PI * 2;
    var sidePoints = [];
    var n = 36;
    var d = d360 / n;
    for (var i = 1; i <= n; i++) {
        var rd = d * i;
        var x = center.lon + radius * Math.cos(rd);
        var y = center.lat + radius * Math.sin(rd);
        var sidePoint = new SuperMap.Geometry.Point(x, y);
        sidePoints.push(sidePoint);
    }
	var line = new SuperMap.Geometry.LinearRing(sidePoints);
	var roundRegion = new SuperMap.Geometry.Polygon(line);
	
    return roundRegion;
}
/** 
 * 获取圆的样式
 */
Dituhui.Fence.getCircleStyle = function() {
	return {
		fillColor: "#fff",
		fillOpacity: 0.5,
		strokeColor: "#c7003a",
		pointRadius:6,
		strokeWidth:4
	}
}

/** 
 * 查询干线电子围栏
 */
Dituhui.Fence.Primary = {};
Dituhui.Fence.Primary.search = function(param) {
	Dituhui.request({
		url: urls.server + '/primaryfence/queryAll',
		success : function(e) {
			if(e && e.records > 0) {
				Fence.display(e.rows);
			}
			else {
				Fence.clear();
			}
		},
		error: function() {
			
		}
	})
}

























